package com.briansteen.sketches;

import net.roarsoftware.lastfm.Event;
import net.roarsoftware.lastfm.Geo;
import net.roarsoftware.lastfm.PaginatedResult;

public class LastFMEvents {
	public static void main(String[] args) {
		String key = "b25b959554ed76058ac220b7b2e0a026"; //this is the key used in the last.fm API examples online.
		PaginatedResult<Event> events = Geo.getEvents("Berlin", null, key);
		int pageAmount = events.getTotalPages();
		int resultCount = 0;
		for(int i=0;i<pageAmount;i++) {
			PaginatedResult<Event> eventsPerPage = Geo.getEvents("Berlin", null, i, key);
			System.out.println("page " + i);
			for (Event event : eventsPerPage.getPageResults()) {
				System.out.println(event.getLatitude() + " " + event.getLongitude());
//				System.out.printf("%s: %s - %s%n", event.getHeadliner(), event.getVenue().getName(),
//						DateFormat.getDateInstance().format(event.getStartDate()));
				resultCount++;
			}
		}
		System.out.println(resultCount);
	}
}
